package com.nbwyctf.helper.utils;

import java.time.LocalDateTime;

/**
 * @author chetaifu
 */
public class TimeUtil {
    /** 获取 当前 timestamp(时间戳) */
    public static Long getCurrentTimestamp(){
        return System.currentTimeMillis();
    }

    public static boolean beforeOrEquals(LocalDateTime t1, LocalDateTime t2) {
        return !t1.isAfter(t2);
    }

    public static boolean afterOrEquals(LocalDateTime t1, LocalDateTime t2) {
        return !t1.isBefore(t2);
    }

    public static boolean between(LocalDateTime time, LocalDateTime min, LocalDateTime max) {
        return beforeOrEquals(min, time) && beforeOrEquals(time, max);
    }
}
